package com.example.administrator;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import java.util.jar.Attributes;

public class MainActivity extends AppCompatActivity implements View.OnClickListener{
    private EditText appUserName;
    private EditText appUserPassWord;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.button).setOnClickListener(this);
        appUserName=findViewById(R.id.user_name);
        appUserPassWord=findViewById(R.id.user_pssword);

    }

    @Override
    public void onClick(View view) {
        String username =appUserName.getText().toString();
        String userpassword =appUserPassWord.getText().toString();
        if(username.equals("xiaohong")&&userpassword.equals("123")){
            Toast.makeText(this,"恭喜您，登录成功",Toast.LENGTH_SHORT).show();
            Intent intent=new Intent(this,SecondActivity.class);
            startActivity(intent);
        }else{
            Toast.makeText(this,"用户名账号或密码错误，登录失败",Toast.LENGTH_SHORT).show();
        }
    }
}
